<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>商品品牌管理</title>
<#include "../common/header.ftl"/>
    <link rel="stylesheet" href="/bootstrap/css/bootstrap.css">
    <script type="text/javascript" src="/js/plugins/fancybox/jquery.fancybox.js"></script>
    <script type="text/javascript" src="/bootstrap/js/jquery.form.js"></script>
    <link type="text/css" rel="stylesheet" href="/js/plugins/uploadifive/uploadifive.css" />
    <script type="text/javascript" src="/js/plugins/uploadifive/jquery.uploadifive.min.js"></script>
    <link rel="stylesheet" href="/bootstrap/css/qunit-1.11.0.css">
    <script type="text/javascript" src="/bootstrap/js/qunit-1.11.0.js"></script>
    <script type="text/javascript" src="/bootstrap/js/bootstrap-paginator.js"></script>

	<#--图片显示样式-->
    <style type="text/css">
		.list_img{
		width: 50px;
		height: 50px;
		margin: 0;
		}

        #realAuthForm input ,#realAuthForm select{
            width: 260px;
        }
        .idCardItem{
            width: 160px;
            height: 150px;
            float:left;
            margin-right:10px;
            border: 1px solid #e3e3e3;
            text-align: center;
            padding: 5px;
        }
        .uploadImg{
            width: 120px;
            height: 100px;
            margin-top: 5px;
        }
        .swfupload{
            left: 0px;
            cursor: pointer;
        }
        .uploadify{
            height: 20px;
            font-size:13px;
            line-height:20px;
            text-align:center;
            position: relative;
            margin-left:auto;
            margin-right:auto;
            cursor:pointer;
            background-color: #337ab7;
            border-color: #2e6da4;
            color: #fff;
        }
        #viewExample{
            position: relative;
            left: 50px;
            top: 60px;
        }
        .uploadExample{
            width: 200px;
            height: 130px;
            margin-bottom: 20px;
        }

    </style>
    <script>
        $(function(){
            $(".pic").fancybox();
        });
    </script>

<script type="text/javascript">
	$(function() {
		$("#query").click(function(){
			$("#currentPage").val(1);
			$("#searchForm").submit();
		})

		//---------------------------------------------
        //数据恢复
        $(".recoverBrand").click(function(){
            var datas = $(this).data("json");
            var brandId = datas.id;
            var chineseName = datas.chineseName;
            $.messager.confirm("温馨提示", "确定要回收>>" + chineseName + "<<品牌记录吗?", function () {
                $.ajax({
                    url: "/recoveryBrand",
                    data: {id: brandId},
                    dataType: "json",
                    success: function (data) {
                        if (data.success) {
                            $.messager.popup("温馨提示: 数据回收成功!") ;
                                window.location.reload();
                        } else {
                            $.messager.alert("温馨提示", "数据回收失败");
                        }
                    }
                })
            });
        })

        //-----------------------------
       //列表页面Bootstrap分页---------------
        var element = $('#pagination');
        var options = {
            bootstrapMajorVersion:3,
            currentPage:    ${pageResult.currentPage!""},       //当前页
            numberOfPages:  5,                                  //设置控件显示的页码数.即：类型为"page"的操作按钮的数量
            totalPages:     ${pageResult.totalPage!""},         //总页数
            size:'14px',                                        //大小
            alignment:'center',                                 //位置
            pageUrl: function(type, page, current){             //访问连接[]
                return "#"+page;
            },
            itemTexts: function (type, page, current) {        //样式文字设置
                switch (type) {
                    case "first":
                        return "首页";
                    case "prev":
                        return "前一页";
                    case "next":
                        return "下一页";
                    case "last":
                        return "最后";
                    case "page":
                        return ""+page;
                }
            },
            shouldShowPage:function(type, page, current){//控制哪些显示，哪些隐藏
                switch(type)
                {
                    case "first":
                    case "last":
                        return false;  //首页最后一页隐藏
                    default:
                        return true;  //其他显示
                }
            },
            tooltipTitles: function (type, page, current) { //提示框，当鼠标放上去给提示
                switch (type) {
                    case "first":
                        return "提示首页";
                    case "prev":
                        return "提示前页";
                    case "next":
                        return "Tooltip for next page";
                    case "last":
                        return "Tooltip for last page";
                }
            },
            useBootstrapTooltip:true,
            onPageClicked: function(e,originalEvent,type,page){
                $("#currentPage").val(page);   //type是first,pre 等,  page是需要提交的页码
                $("#searchForm").submit();    //提交查询
            }
        }
        element.bootstrapPaginator(options);   //传入参数选项
        //-----------------------------







        //返回
        $("#goback").click(function(){
           window.location.href="brandList";
        });
	});
</script>
</head>
<body>
	<div class="container">
		<#include "../common/top.ftl"/>
		<div class="row">
			<div class="col-sm-3"><#assign currentMenu="brandList" />
				<#include "../common/menu.ftl" />
			</div>
			<div class="col-sm-9">
				<div class="page-header">
					<h3>品牌回收站</h3>
				</div>
				<form id="searchForm" class="form-inline" method="post" action="/recoveryBrandList">

					<input type="hidden" id="currentPage" name="currentPage" value=""/>

					<div class="form-group">
                        <input type="text" class="form-control" value="${qo.keyword!''}"  name="keyword" name="keyword"
							    placeholder="名称/描述/版本" style="background-color: #eefbbb; padding-right: 150px" >
						<button id="query" class="btn btn-success"><i class="icon-search"></i> 查询</button>
					</div>
				</form>

                <div class="panel panel-default">
                    <table class="table">
                        <thead>
                        <tr align="center">
                            <th>品牌logo</th>
                            <th>中文名</th>
                            <th>英文名</th>
                            <th>品牌描述</th>
                            <th>品牌网址</th>
                            <th>品牌版本</th>
                            <th>品牌排序</th>
                            <th>数据回收</th>
                        </tr>
                        </thead>
                        <tbody>

                        <#list pageResult.list as info>
                        <tr>
                            <td>
                                <a href="${info.logo!""}" >
                                    <img src="${info.logo!""}" class ="list_img">
                                </a>
                            </td>
                            <td style="padding-top: 25px">${info.chineseName}</td>
                            <td style="padding-top: 25px">${info.englishName!""}</td>
                            <td style="padding-top: 25px">${info.description!""}</td>
                            <td style="padding-top: 25px">${info.url!""}</td>
                            <td style="padding-top: 25px">${info.version!""}</td>
                            <td style="padding-top: 25px">${info.sequence!""}</td>
                            <td style="padding-top: 20px">
                                <a href="javascript:void(-1)"class="recoverBrand" data-json='${info.jsonString}'><img border="0" src="/images/恢复.png" /></a>
                            </td>  <#--如果使用#, 会在URL后面自动加上#, 无法刷新. 但是"javascript:void(-1)"的作用: 避免在URL后面添加上不必要的-->
                        </tr>
                        </#list>
                        </tbody>
                    </table>

                    <!--此处分页-->
                    <div style="text-align: center;">
                        <ul id="pagination" class="pagination"></ul>
                    </div>

                </div>
                <div align="center">
                    <button type="button" class="btn btn-info" id="goback">返回>品牌管理<.</button>
                </div>


	</div>
</body>
</html>